<template>
  <div style="height: 70px;width: 100%;background: #aeb3c5;text-align: center">
    <span style="color: white;line-height: 70px;font-size: 25px">日志一览</span>
  </div>
  <el-table :data="cutObj.records" style="width: 100%">
    <el-table-column prop="date" label="日期"/>
    <el-table-column prop="info" label="内容"/>
  </el-table>

  <div style="display: flex;justify-content: space-around;margin-top: 50px">
    <div>
      <!--页码-->
      <el-pagination
          v-model:currentPage="cutObj.current"
          v-model:page-size="cutObj.size"
          background
          layout="prev, pager, next, jumper"
          :total="cutObj.total"
          @current-change="findByItem"
      />
    </div>
    <!--查询信息-->
    <el-card class="box-card">
      <template #header>
        <div class="card-header">
          <span>查询日志信息</span>
          <el-button type="primary" @click="findByItem(1)">查找</el-button>
        </div>
      </template>
      <div class="text item">
        <div style="margin-top: 30px">
          起始日期：
          <el-date-picker
              v-model="findObj.startDate"
              type="date"
              placeholder="选择起始日期"
              value-format="YYYY-MM-DD">
          </el-date-picker>
        </div>
        <div style="margin-top: 30px">
          结束日期：
          <el-date-picker
              v-model="findObj.endDate"
              type="date"
              placeholder="选择结束日期"
              value-format="YYYY-MM-DD">
          </el-date-picker>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
import axios from "axios"

export default {
  data() {
    return {
      cutObj: {},
      findObj: {},
    }
  },
  methods: {
    findByItem(pageNO) {
      this.findObj.pageNO = pageNO;
      axios.get("/project/log/findByItem", {
        params: this.findObj
      }).then(resp => {
        this.cutObj = resp.data;
      })

    }
  },
  created() {
    this.findByItem(1)
  }
}
</script>

<style scoped>
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.box-card {
  width: 480px;
}
</style>